﻿///<copyright>
/// Copyright © 2009 Stephen Styrchak. All Rights Reserved.
///</copyright>
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Ferpect.ComponentModel.Design
{
    internal class DesignTimeGameLoop : IGameLoop
    {
        private GraphicsDevice graphicsDevice;
        private GameServiceContainer serviceContainer;

        public DesignTimeGameLoop(GraphicsDevice graphicsDevice, DesignTimeContentManager contentManager)
        {
            if (graphicsDevice == null) throw new ArgumentNullException("graphicsDevice");
            if (contentManager == null) throw new ArgumentNullException("contentManager");

            this.graphicsDevice = graphicsDevice;
            this.Content = contentManager;
            this.serviceContainer = new GameServiceContainer();
        }

        #region IGameLoop Members

        public Microsoft.Xna.Framework.Content.ContentManager Content
        {
            get;
            set;
        }

        public Microsoft.Xna.Framework.Graphics.GraphicsDevice GraphicsDevice
        {
            get { return this.graphicsDevice; }
        }

        public TimeSpan InactiveSleepTime
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public bool IsActive
        {
            get { throw new NotImplementedException(); }
        }

        public bool IsFixedTimeStep
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public bool IsMouseVisible
        {
            get
            {
                return true;
            }
            set
            {
            }
        }

        public GameServiceContainer Services
        {
            get { return this.serviceContainer; }
        }

        public TimeSpan TargetElapsedTime
        {
            get
            {
                return TimeSpan.FromSeconds(1.0 / 30.0);
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public GameWindow Window
        {
            get { throw new NotImplementedException(); }
        }

        // Disable warning for unused events. These are required as part of the interface,
        // even though we don't actually fire them.
#pragma warning disable 67
        public event EventHandler<EventArgs> Activated;

        public event EventHandler<Microsoft.Xna.Framework.GameComponentCollectionEventArgs> ComponentAdded;

        public event EventHandler<Microsoft.Xna.Framework.GameComponentCollectionEventArgs> ComponentRemoved;

        public event EventHandler<EventArgs> Deactivated;

        public event EventHandler<EventArgs> Exiting;
#pragma warning restore 67

        public void AddComponent(Microsoft.Xna.Framework.IGameComponent component)
        {
        }

        public void EnableGamerServices()
        {
        }

        public void Exit()
        {
        }

        public void RemoveComponent(Microsoft.Xna.Framework.IGameComponent component)
        {
        }

        public void ResetElapsedTime()
        {
        }

        public void SuppressDraw()
        {
        }

        public void Tick()
        {
        }

        #endregion
    }
}
